import { getUserInfoListService, getDepartmentsService } from '@/api/usercenter';
import { queryOrgItemListService } from '@/api/public';
import { WORKFLOW_STATUS_OPTIONS } from './config';

export const FORM_ITEMS = [
  {
    prop: 'recordNo',
    label: '单据号',
    type: 'input',
  },
  {
    prop: 'skuNo',
    label: 'SKU编码',
    type: 'input',
  },
  {
    prop: 'belongHrDepartmentNum',
    label: '归属部门',
    type: 'select',
    remote: true,
    remoteMethod: queryOrgItemListService,
    clearable: true,
    paramKey: 'orgName'
  },
  {
    prop: 'createOper',
    label: '提交人',
    type: 'select',
    remote: true,
    remoteMethod: getUserInfoListService,
    paramKey: 'userName',
    optionKeys: { valueKey: 'userIdStr', labelKey: 'userName', codeKey: 'jobNumber' },
  },
  {
    prop: 'creatorDeptUuid',
    label: '提交部门',
    type: 'select',
    remote: true,
    clearable: true,
    remoteMethod: getDepartmentsService,
    paramKey: 'departmentName',
    optionKeys: { valueKey: 'departmentId', labelKey: 'departmentName' },
  },
  {
    prop: 'createOpeTime',
    label: '提交时间',
    type: 'datePicker',
    datePickerType: 'daterange',
    valueFormat: 'yyyy-MM-dd',
  },
  {
    prop: 'workflowStatus',
    label: '单据状态',
    type: 'select',
    options: WORKFLOW_STATUS_OPTIONS,
  },
  {
    prop: 'orderNo',
    label: '订货单号',
    type: 'input',
  },
  {
    prop: 'orderInquiryNo',
    label: '询价单号',
    type: 'input',
  },
  {
    prop: 'deliveryTime',
    label: '要求到货时间',
    type: 'datePicker',
    datePickerType: 'daterange',
    valueFormat: 'yyyy-MM-dd',
  },
]

export const TABLE_COLUMNS = [
  {
    title: '单据号',
    key: 'recordNo',
    width: 220
  },
  {
    title: '订货单号',
    key: 'orderNo',
  },
  {
    title: '订货询价单号',
    key: 'orderInquiryNo',
    width: 110
  },
  {
    title: '最早要求到货时间',
    key: 'deliveryTime',
    width: 120
  },
  {
    title: '单据状态',
    key: 'workflowStatusStr',
  },
  {
    title: '归属部门',
    key: 'belongHrDepartmentName',
  },
  {
    title: '提交人',
    key: 'creatorName',
  },
  {
    title: '提交部门',
    key: 'creatorDeptName',
  },
  {
    title: '提交时间',
    key: 'createOpeTime',
  },
]
